package com.albaba.designpattern.prototype.text_004;

import com.albaba.designpattern.prototype.text_003.AdvTemplate;
import com.albaba.designpattern.prototype.text_004.Mail;

import java.util.UUID;

/**
 * @author zx
 * @version 1.0
 * @description 业务场景
 * @date 2025/2/19 22:22
 */
public class Client {

    // 发送邮件的数量
    private static int count = 6;

    // 发送邮件的功能
    public static void sendMail(Mail mail) {
        System.out.println("标题：" + mail.getSubject() +
                ", 收件人：" + mail.getReceiver()
                + "\t 发送成功");
    }


    public static void main(String[] args) throws Exception {

        int i = 0;
        Mail mail = new Mail(new AdvTemplate());
        mail.setTail("XX银行版权所有");
        mail.setSubject("来自XX银行");
        mail.setAppellation("尊敬的XX银行用户");
        mail.setContext("这是一封来自XX银行公司的邮件");
        mail.setReceiver(UUID.randomUUID().toString());

        while (i < count) {
            Mail cloneMail = mail.clone();
            cloneMail.setAppellation("先生(女士)");
            cloneMail.setReceiver(UUID.randomUUID().toString());
            sendMail(cloneMail);
            i++;
        }

    }

}
